angular.module('imsApp').controller('disallowAddModalController', ['$scope', 'DisallowManager','mode','$uibModalInstance', function ($scope, DisallowManager,mode,$uibModalInstance) {
    $scope.mode = mode;
    $scope.disallow={type:410};
    $scope.ok = function () {
        saveFocusData();

    };

    $scope.cancel = function () {
        $uibModalInstance.dismiss("cancel");
    };

    var saveFocusData=function () {
        if(mode=='ip'){
            DisallowManager.ipAdd({list:[[$scope.disallow.ip,$scope.disallow.type]]}).then(function (result) {
                if(result.data.c=='s'){
                    $uibModalInstance.close("ok");
                }else{
                    $uibModalInstance.close("error");

                }
            })
        }else{
            DisallowManager.cuidAdd({list:[[$scope.disallow.cuid,$scope.disallow.type]]}).then(function (result) {
                if(result.data.c=='s'){
                    $uibModalInstance.close("ok");
                }else{
                    $uibModalInstance.close("error");

                }
            })
        }

    }




}])

